package cn.ztuo.bitrade.controller.ieo;


import cn.ztuo.bitrade.entity.IeoLevel;
import cn.ztuo.bitrade.entity.IeoMent;
import cn.ztuo.bitrade.service.IeoLevelService;
import cn.ztuo.bitrade.service.IeoMentService;
import cn.ztuo.bitrade.util.MessageResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("ieoConfig")
@Slf4j
public class IeoConfigController {


    @Autowired
    private IeoMentService ieoMentService;

    @Autowired
    private IeoLevelService ieoLevelService;


    /**
     * 获取社区节数量,价格
     * @return
     */
    @RequiresPermissions("ieoConfig:mentList")
    @RequestMapping(value = "mentList",method = RequestMethod.POST)
    public MessageResult mentList(){
        return MessageResult.getSuccessInstance("成功",ieoMentService.findAll());
    }
    /**
     * 社区信息参数修改
     * @return
     */
    @RequiresPermissions("ieoConfig:mentSave")
    @RequestMapping(value = "mentSave",method = RequestMethod.POST)
    public MessageResult save(IeoMent ieoMent){
        ieoMentService.save(ieoMent);
        return MessageResult.success("操作成功");
    }

    /**
     * 获取激活
     * @return
     */
    @RequiresPermissions("ieoConfig:ieoLevel")
    @RequestMapping(value = "ieoLevel",method = RequestMethod.POST)
    public MessageResult ieoLimit(){
        return MessageResult.getSuccessInstance("成功",ieoLevelService.selecAll());
    }

    @RequiresPermissions("ieoConfig:ieoLevelSave")
    @RequestMapping(value = "ieoLevelSave",method = RequestMethod.POST)
    public MessageResult ieoLimitSave(IeoLevel ieoLevel){
        ieoLevelService.save(ieoLevel);
        return MessageResult.success("操作成功");
    }
}
